home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WTRANSAC.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  21.9 KB  |  824 lines

  1. /*************************************************************************
  2.  *
  3.  * WTransaction -- WClass Transaction object.
  4.  *
  5.  *************************************************************************/
  6.  
  7. #ifndef _WTRANSAC_HPP_INCLUDED
  8. #define _WTRANSAC_HPP_INCLUDED
  9.  
  10. #ifndef _WDATAERR_HPP_INCLUDED
  11. #include "wdataerr.hpp"
  12. #endif
  13. #ifndef _WDATAOBJ_HPP_INCLUDED
  14. #include "wdataobj.hpp"
  15. #endif
  16. #ifndef _WVECTOR_HPP_INCLUDED
  17. #include "wvector.hpp"
  18. #endif
  19. #ifndef _WQUERY_HPP_INCLUDED
  20. #include "wquery.hpp"
  21. #endif
  22.  
  23. extern template WVector<WQuery>;
  24.  
  25. //
  26. // Bytes used to hold messages
  27. //
  28.  
  29. #define WT_STATE_LEN            6
  30. #define WT_ERRORMESSAGE_LEN     2048
  31. #define WT_CONNSTR_LEN          1024
  32. #define WT_DSNAME_LEN           256
  33. #define WT_DSDESC_LEN           1024
  34. #define WT_OPTION_VALUE_LEN     512
  35.  
  36. //
  37. // Flags used with the List method
  38. //
  39.  
  40. #define WTF_INDEX_UNIQUE        0x00000001
  41. #define WTF_ENSURE_VALIDITY     0x00000002
  42.  
  43. //
  44. // WTListType
  45. //
  46. // Standard list types returned by the List method
  47. //
  48.  
  49. enum WTListType {
  50.     WTLColumnPrivileges = 1,
  51.     WTLColumns,
  52.     WTLForeignKeys,
  53.     WTLIndexes,
  54.     WTLPrimaryKeys,
  55.     WTLProcedureColumns,
  56.     WTLProcedures,
  57.     WTLTablePrivileges,
  58.     WTLTables,
  59.  
  60.     WTLLASTLISTTYPE = LAST_32BIT
  61. };
  62.  
  63. //
  64. // WTOptionID
  65. //
  66. // Standard option ids for use with Get*Option and Set*Option.
  67. // Values match those for the corresponding ODBC connection options for
  68. // convenience.
  69. //
  70.  
  71. enum WTOptionID {
  72.     WTONULLOPTION = 0,
  73.  
  74.     WTOAccessMode = SQL_ACCESS_MODE,
  75.     WTOAutoCommit = SQL_AUTOCOMMIT,
  76.     WTOCurrentQualifier = SQL_CURRENT_QUALIFIER,
  77.     WTOIsolationLevel = SQL_TXN_ISOLATION,
  78.     WTOLoginTimeout = SQL_LOGIN_TIMEOUT,
  79.     WTOODBCCursors = SQL_ODBC_CURSORS,
  80.     WTOPacketSize = SQL_PACKET_SIZE,
  81.     WTOQuietMode = SQL_QUIET_MODE,
  82.     WTOTrace = SQL_OPT_TRACE,
  83.     WTOTraceFile = SQL_OPT_TRACEFILE,
  84.     WTOTranslateDll = SQL_TRANSLATE_DLL,
  85.     WTOTranslateOption = SQL_TRANSLATE_OPTION,
  86.     WTOCursorDriver = SQL_ODBC_CURSORS,
  87.  
  88.     WTOLASTSTANDARDOPTION = SQL_CONNECT_OPT_DRVR_START - 1,
  89.  
  90.     WTOLASTOPTION = LAST_32BIT
  91. };
  92.  
  93. //
  94. // WTOptionInfo
  95. //
  96. // Hold information about an option -- used to implement GetOptionInfo.
  97. //
  98.  
  99. struct WTOptionInfo {
  100.     WTOptionID          id;
  101.     const WChar *       name;
  102.     WBool               isString;       // isNumeric otherwise
  103. };
  104.  
  105. //
  106. // Possible property values.
  107. //
  108. // These match ODBC for convenience.
  109. //
  110.  
  111. //
  112. // WTAccessMode
  113. //
  114.  
  115. enum WTAccessMode {
  116.     WTAMUnknown = -1,
  117.     WTAMReadOnly = SQL_MODE_READ_ONLY,
  118.     WTAMReadWrite = SQL_MODE_READ_WRITE
  119. };
  120.  
  121. //
  122. // WTBookmarkPersistence
  123. //
  124.  
  125. typedef WDWord WTBookmarkPersistence;
  126.  
  127. #define WTBPUnknown          0x80000000
  128. #define WTBPClose            SQL_BP_CLOSE
  129. #define WTBPDelete           SQL_BP_DELETE
  130. #define WTBPDrop             SQL_BP_DROP
  131. #define WTBPScroll           SQL_BP_SCROLL
  132. #define WTBPTransaction      SQL_BP_TRANSACTION
  133. #define WTBPUpdate           SQL_BP_UPDATE
  134. #define WTBPOtherStatement   SQL_BP_OTHER_HSTMT
  135.  
  136. //
  137. // WTFetchDirection
  138. //
  139.  
  140. typedef WDWord WTFetchDirection;
  141.  
  142. #define WTFDUnknown    0x80000000
  143. #define WTFDNext       SQL_FD_FETCH_NEXT
  144. #define WTFDFirst      SQL_FD_FETCH_FIRST
  145. #define WTFDLast       SQL_FD_FETCH_LAST
  146. #define WTFDPrevious   SQL_FD_FETCH_PRIOR
  147. #define WTFDAbsolute   SQL_FD_FETCH_ABSOLUTE
  148. #define WTFDRelative   SQL_FD_FETCH_RELATIVE
  149. #define WTFDBookmark   SQL_FD_FETCH_BOOKMARK
  150.  
  151. //
  152. // WTIsolationLevel
  153. //
  154.  
  155. enum WTIsolationLevel {
  156.     WTILUnknown          = 0xFFFFFFFF,
  157.     WTILReadUncommitted  = SQL_TXN_READ_UNCOMMITTED,
  158.     WTILReadCommitted    = SQL_TXN_READ_COMMITTED,
  159.     WTILRepeatableRead   = SQL_TXN_REPEATABLE_READ,
  160.     WTILSerializable     = SQL_TXN_SERIALIZABLE,
  161.     WTILVersioning       = SQL_TXN_VERSIONING
  162. };
  163.  
  164. //
  165. // WTLoginPrompt
  166. //
  167.  
  168. enum WTLoginPrompt {
  169.     WTLPAlways = SQL_DRIVER_PROMPT,
  170.     WTLPIfRequired = SQL_DRIVER_COMPLETE_REQUIRED,
  171.     WTLPNever = SQL_DRIVER_NOPROMPT
  172. };
  173.  
  174. //
  175. // WTStaticSensitivity
  176. //
  177.  
  178. typedef WDWord WTStaticSensitivity;
  179.  
  180. #define WTSSUnknown   0x80000000
  181. #define WTSSAdditions SQL_SS_ADDITIONS
  182. #define WTSSDeletions SQL_SS_DELETIONS
  183. #define WTSSUpdates   SQL_SS_UPDATES
  184.  
  185. //
  186. // WTCursorTypes
  187. //
  188.  
  189. typedef WDWord WTCursorTypes;
  190.  
  191. #define WTCTForwardOnly  SQL_SO_FORWARD_ONLY
  192. #define WTCTStatic       SQL_SO_STATIC
  193. #define WTCTKeysetDriven SQL_SO_KEYSET_DRIVEN
  194. #define WTCTDynamic      SQL_SO_DYNAMIC
  195. #define WTCTMixed        SQL_SO_MIXED
  196.  
  197. //
  198. // WTUpdateTypes
  199. //
  200.  
  201. typedef WDWord WTUpdateTypes;
  202.  
  203. //
  204. // bitmask for supported update types.
  205. //
  206.  
  207. #define WTUTNone      0x01
  208. #define WTUTDirect    0x02
  209. #define WTUTCursor    0x04
  210. #define WTUTKey       0x08
  211.  
  212. //
  213. // WTCursorDriver
  214. //
  215.  
  216. enum WTCursorDriver {
  217.     WTCDSimulateIfNeeded = SQL_CUR_USE_IF_NEEDED,
  218.     WTCDSimulate = SQL_CUR_USE_ODBC,
  219.     WTCDNative = SQL_CUR_USE_DRIVER
  220. };
  221.  
  222. //
  223. // WTQualifierLocation
  224. //
  225.  
  226. enum WTQualifierLocation {
  227.     WTQLStart = SQL_QL_START,
  228.     WTQLEnd = SQL_QL_END
  229. };
  230.  
  231. //
  232. // WTFileUsage
  233. //
  234.  
  235. enum WTFileUsage {
  236.     WTFUNotSupported = SQL_FILE_NOT_SUPPORTED,
  237.     WTFUTable = SQL_FILE_TABLE,
  238.     WTFUQualifier = SQL_FILE_QUALIFIER,
  239. };
  240.  
  241. //
  242. // WTCursorCommitBehaviour, WTCursorRollbackBehaviour values
  243. //
  244.  
  245. #define WTCBUnknown  -1
  246. #define WTCBDelete   SQL_CB_DELETE
  247. #define WTCBClose    SQL_CB_CLOSE
  248. #define WTCBPreserve SQL_CB_PRESERVE
  249.  
  250. //
  251. // WTCursorRollbackBehaviour
  252. //
  253. typedef WShort WTCursorCommitBehavior;
  254. typedef WShort WTCursorRollbackBehavior;
  255.  
  256. //
  257. // ListSource
  258. //
  259. // Used with the List* methods to specify a table, column, procedure, ...
  260. //
  261.  
  262. class WCMCLASS WTListSource {
  263.  
  264.     public:
  265.  
  266.         WTListSource();
  267.  
  268.         ~WTListSource();
  269.  
  270.         WString         qualifier;
  271.         WString         owner;
  272.         WString         name;
  273.         WString         column;
  274.         WString         type;           // TABLE, VIEW, PROCEDURE, etc.
  275. };
  276.  
  277. //
  278. // WTransaction
  279. //
  280.  
  281. class WCMCLASS WTransaction : public WObject {
  282.  
  283.     WDeclareSubclass( WTransaction, WObject );
  284.  
  285.     public:
  286.  
  287.         WTransaction();
  288.  
  289.         virtual ~WTransaction();
  290.  
  291.         /***************************************************************
  292.          * Properties
  293.          ***************************************************************/
  294.  
  295.         // AccessMode
  296.         //
  297.         //    Set the access mode for the connection. Read/write by
  298.         //    default.
  299.  
  300.         virtual WTAccessMode GetAccessMode() const;
  301.         virtual WBool        SetAccessMode( WTAccessMode accessMode );
  302.  
  303.         // AutoCommit
  304.         //
  305.         //    Controls whether operations on the database are
  306.         //    committed automatically.
  307.  
  308.         virtual WBool GetAutoCommit() const;
  309.         virtual WBool SetAutoCommit( WBool autoCommit );
  310.  
  311.         // BookmarkPersistence
  312.         //
  313.         //    Returns a set of flags describing the bookmark
  314.         //    persistence.
  315.  
  316.         virtual WTBookmarkPersistence GetBookmarkPersistence() const;
  317.  
  318.         // Connected
  319.         //
  320.         //    Returns TRUE if a connection is active.
  321.  
  322.         virtual WBool GetConnected() const;
  323.  
  324.         // ConnectionHandle
  325.         //
  326.         //    Sets the connection handle.  Used with ODBC.
  327.  
  328.         virtual WDWord GetConnectionHandle() const;
  329.         virtual WBool  SetConnectionHandle( WDWord conn );
  330.  
  331.         // ConnectParams
  332.         //
  333.         //    Database-specific string used when connecting.
  334.  
  335.         virtual WString GetConnectParams() const;
  336.         virtual WBool   SetConnectParams( const WString & connectParams );
  337.  
  338.         // CursorDriver
  339.         //
  340.         //    Determines if cursor scrolling should be simulated
  341.         //    or whether the native driver should be used.  The
  342.         //    default is to use the native driver.
  343.  
  344.         virtual WTCursorDriver GetCursorDriver() const;
  345.         virtual WBool          SetCursorDriver( WTCursorDriver driv );
  346.  
  347.         // DataSource
  348.         //
  349.         //    Identifies the database to use.
  350.  
  351.         virtual WString GetDataSource() const;
  352.         virtual WBool   SetDataSource( const WString & dataSource );
  353.  
  354.         // DBMSName
  355.         //
  356.         //    Identifies the type of database interface to use.  The
  357.         //    default is "ODBC".
  358.  
  359.         virtual WString GetDBMSName() const;
  360.         virtual WBool   SetDBMSName( const WString & dbmsName );
  361.  
  362.         // DisplayErrorDialog
  363.         //
  364.         //    When an error occurs, display a dialog describing the
  365.         //    error.  TRUE by default.
  366.  
  367.         virtual WBool GetDisplayErrorDialog() const;
  368.         virtual WBool SetDisplayErrorDialog( WBool display );
  369.  
  370.         // DisplayWarningDialog
  371.         //
  372.         //    When a warning occurs, display a dialog describing the
  373.         //    warning.  FALSE by default.
  374.  
  375.         virtual WBool GetDisplayWarningDialog() const;
  376.         virtual WBool SetDisplayWarningDialog( WBool display );
  377.  
  378.         // Driver
  379.         //
  380.         //    Return a pointer to the underlying WTransaction subclass.
  381.  
  382.         virtual WTransaction *GetDriver() const;
  383.  
  384.         // EnvironmentHandle
  385.         //
  386.         //    Sets the environment handle.  Used only with ODBC.
  387.  
  388.         virtual WDWord GetEnvironmentHandle() const;
  389.         virtual WBool  SetEnvironmentHandle( WDWord envHandle );
  390.  
  391.         // ErrorCode
  392.         //
  393.         //    Returns the error code of the last driver operation.
  394.         //    Can optionally return a code specifying which driver
  395.         //    API was called (driver-specific).
  396.  
  397.         virtual WLong GetErrorCode( WLong *apiFunc = NULL ) const;
  398.  
  399.         // ErrorList
  400.         //
  401.         //    Returns the list of errors from the last operation.
  402.  
  403.         virtual WDataErrorArray GetErrorList() const;
  404.  
  405.         // FetchDirection
  406.         //
  407.         //    Returns which fetch operations are supported by the
  408.         //    database.  Read-only.
  409.  
  410.         virtual WTFetchDirection GetFetchDirection() const;
  411.  
  412.         // FileUsage
  413.         //
  414.         //    Determines how files are treated (as databases or tables).
  415.  
  416.         virtual WTFileUsage GetFileUsage() const;
  417.  
  418.         // IsolationLevel
  419.         //
  420.         //
  421.  
  422.         virtual WTIsolationLevel GetIsolationLevel() const;
  423.         virtual WBool            SetIsolationLevel( WTIsolationLevel level );
  424.  
  425.         // LoginID
  426.         //
  427.         //    The login ID for the server (optional).
  428.  
  429.         virtual WString GetLoginID() const;
  430.         virtual WBool   SetLoginID( const WString & lid );
  431.  
  432.         // LoginPassword
  433.         //
  434.         //    The login password for the server (optional).
  435.  
  436.         virtual WString GetLoginPassword() const;
  437.         virtual WBool   SetLoginPassword( const WString & pwd );
  438.  
  439.         // LoginPrompt
  440.         //
  441.         //
  442.  
  443.         virtual WTLoginPrompt GetLoginPrompt() const;
  444.         virtual WBool         SetLoginPrompt( WTLoginPrompt prompt );
  445.  
  446.         // MaxOptionIndex
  447.         //
  448.         //    Index of the last option (largest index value that may be passed
  449.         //    to GetOptionInfo).
  450.  
  451.         virtual WLong GetMaxOptionIndex() const;
  452.  
  453.         // NumericOption
  454.         //
  455.         //
  456.  
  457.         virtual WLong GetNumericOption( WTOptionID id ) const;
  458.         virtual WBool SetNumericOption( WTOptionID id, const WLong value );
  459.  
  460.         // Password
  461.         //
  462.         //
  463.  
  464.         virtual WString GetPassword() const;
  465.         virtual WBool   SetPassword( const WString & password );
  466.  
  467.         // ServerName
  468.         //
  469.         //    The name of the server (optional).
  470.  
  471.         virtual WString GetServerName() const;
  472.         virtual WBool   SetServerName( const WString & server );
  473.  
  474.         // QualifierLocation
  475.         //
  476.         //    The location of the qualifier in a fully qualified table
  477.         //    name.
  478.  
  479.         virtual WTQualifierLocation GetQualifierLocation() const;
  480.  
  481.         // QualifierSeparator
  482.         //
  483.         //    The string that separates the qualifier from the rest
  484.         //    of the table name.
  485.  
  486.         virtual WString GetQualifierSeparator() const;
  487.  
  488.         // StaticSensitivity
  489.         //
  490.         //    Returns whether static or keyset cursors know about changes
  491.         //    made by the current user.
  492.  
  493.         virtual WTStaticSensitivity GetStaticSensitivity() const;
  494.  
  495.         // StringOption
  496.         //
  497.         //
  498.  
  499.         virtual WString GetStringOption( WTOptionID id ) const;
  500.         virtual WBool   SetStringOption( WTOptionID id, const WString & value );
  501.  
  502.         // SupportedCursorTypes
  503.         //
  504.         //    Returns a mask of supported cursor types.
  505.  
  506.         virtual WTCursorTypes GetSupportedCursorTypes() const;
  507.  
  508.         // SupportedUpdateTypes
  509.         //
  510.         //    Returns a mask of supported update types.
  511.  
  512.         virtual WTUpdateTypes GetSupportedUpdateTypes() const;
  513.  
  514.         // SupportsBookmarks
  515.         //
  516.         //    Returns TRUE if the database supports bookmarks.  Read-only.
  517.  
  518.         WBool GetSupportsBookmarks() const;
  519.  
  520.         // TraceToLog
  521.         //
  522.         //    In debug mode, if TRUE traces important actions
  523.         //    to the debug log.  Has no effect for release mode
  524.         //    applications.  (This is not the same as the ODBC
  525.         //    trace log.)
  526.  
  527.         virtual WBool GetTraceToLog() const;
  528.         virtual WBool SetTraceToLog( WBool on );
  529.  
  530.         // Userid
  531.         //
  532.         //
  533.  
  534.         virtual WString GetUserid() const;
  535.         virtual WBool   SetUserid( const WString & userid );
  536.  
  537.         // CursorCommitBehavior
  538.         //
  539.         //    Returns how a COMMIT operation affects cursors and prepared
  540.         //    statements in the data source.
  541.         //
  542.  
  543.         virtual WTCursorCommitBehavior GetCursorCommitBehavior() const;
  544.  
  545.         // CursorRollbackBehavior
  546.         //
  547.         //    Returns how a ROLLBACK operation affects cursors and prepared
  548.         //    statements in the data source.
  549.         //
  550.  
  551.         virtual WTCursorRollbackBehavior GetCursorRollbackBehavior() const;
  552.  
  553.         /***************************************************************
  554.          * Methods
  555.          ***************************************************************/
  556.  
  557.         // Commit
  558.         //
  559.         //
  560.  
  561.         virtual WBool Commit();
  562.  
  563.         // Connect
  564.         //
  565.         //
  566.  
  567.         virtual WBool Connect( WWindow *parent=NULL, WBool doConnect=TRUE );
  568.  
  569.         // Create
  570.         //
  571.         //
  572.  
  573.         virtual WBool Create( WDWord envHandle=0, WDWord connHandle=0 );
  574.         virtual WBool Create( const WString & dbmsName );
  575.  
  576.         // Destroy
  577.         //
  578.         //
  579.  
  580.         virtual WBool Destroy();
  581.  
  582.         // Disconnect
  583.         //
  584.         //
  585.  
  586.         virtual WBool Disconnect( WBool doDisconnect=TRUE );
  587.  
  588.         // FetchErrors
  589.         //
  590.         //    Clear the current error list and fetch errors from the
  591.         //    driver for later retrieval with
  592.         //    GetErrorList.  Note that this function is called automatically
  593.         //    by most of the other methods, so you should only call it
  594.         //    after directly invoking an operation on the driver.
  595.         //    You pass in the return code and function code of the
  596.         //    last operation.  Returns TRUE if messages were fetched
  597.         //    from the driver.
  598.  
  599.         virtual WBool FetchErrors( WLong errorCode, WLong funcCode );
  600.  
  601.         // List
  602.         //
  603.         //    Pass NULL for parameters that are not required.
  604.  
  605.         virtual WBool List( WQuery & query, WTListType type,
  606.                             const WTListSource *source,
  607.                             const WTListSource *source2 = NULL,
  608.                             WDWord flags = WTF_ENSURE_VALIDITY );
  609.  
  610.         // ListColumnPrivileges
  611.         //
  612.         //
  613.  
  614.         WBool ListColumnPrivileges( WQuery & query,
  615.                                     const WString & qualifier,
  616.                                     const WString & owner,
  617.                                     const WString & name,
  618.                                     const WString & column );
  619.  
  620.         // ListColumns
  621.         //
  622.         //
  623.  
  624.         WBool ListColumns( WQuery & query,
  625.                            const WString & qualifier,
  626.                            const WString & owner,
  627.                            const WString & name,
  628.                            const WString & column );
  629.  
  630.         // ListForeignKeys
  631.         //
  632.         //
  633.  
  634.         WBool ListForeignKeys( WQuery & query,
  635.                                const WString & primaryQualifier,
  636.                                const WString & primaryOwner,
  637.                                const WString & primaryName,
  638.                                const WString & foreignQualifier,
  639.                                const WString & foreignOwner,
  640.                                const WString & foreignName );
  641.  
  642.         // ListIndexes
  643.         //
  644.         //
  645.  
  646.         WBool ListIndexes( WQuery & query,
  647.                            const WString & qualifier,
  648.                            const WString & owner,
  649.                            const WString & name,
  650.                            WBool uniqueOnly = FALSE,
  651.                            WBool ensureValidity = TRUE );
  652.  
  653.         // ListPrimaryKeys
  654.         //
  655.         //
  656.  
  657.         WBool ListPrimaryKeys( WQuery & query,
  658.                                const WString & qualifier,
  659.                                const WString & owner,
  660.                                const WString & name );
  661.  
  662.         // ListProcedureColumns
  663.         //
  664.         //
  665.  
  666.         WBool ListProcedureColumns( WQuery & query,
  667.                                     const WString & qualifier,
  668.                                     const WString & owner,
  669.                                     const WString & name,
  670.                                     const WString & column );
  671.  
  672.         // ListProcedures
  673.         //
  674.         //
  675.  
  676.         WBool ListProcedures( WQuery & query,
  677.                               const WString & qualifier,
  678.                               const WString & owner,
  679.                               const WString & name );
  680.  
  681.         // ListTablePrivileges
  682.         //
  683.         //
  684.  
  685.         WBool ListTablePrivileges( WQuery & query,
  686.                                    const WString & qualifier,
  687.                                    const WString & owner,
  688.                                    const WString & name );
  689.  
  690.         // ListTables
  691.         //
  692.         //
  693.  
  694.         WBool ListTables( WQuery & query,
  695.                           const WString & qualifier,
  696.                           const WString & owner,
  697.                           const WString & name,
  698.                           const WString & type );
  699.  
  700.         // Rollback
  701.         //
  702.         //
  703.  
  704.         virtual WBool Rollback();
  705.  
  706.         /***************************************************************
  707.          * Item Properties
  708.          ***************************************************************/
  709.  
  710.         // DataSourceInfo
  711.         //
  712.         //
  713.  
  714.         virtual WBool GetDataSourceInfo( WString *name, WString *description,
  715.                                          WBool getFirst = FALSE ) const;
  716.  
  717.         // OptionInfo
  718.         //
  719.         //
  720.  
  721.         virtual WBool GetOptionInfo( WTOptionID & id, WString & name,
  722.                                      WBool *isString = NULL,
  723.                                      WLong index = -1 ) const;
  724.  
  725.         /***************************************************************
  726.          * Query object interface functions
  727.          ***************************************************************/
  728.  
  729.         // AddQuery
  730.         //
  731.         //
  732.  
  733.         virtual WBool AddQuery( WQuery *query );
  734.  
  735.         // RemoveQuery
  736.         //
  737.         //
  738.  
  739.         virtual WBool RemoveQuery( WQuery *query );
  740.  
  741.         // RemoveAllQueries
  742.         //
  743.         //    Calls SetTransactionObject(NULL) on each query object.
  744.  
  745.         virtual WBool RemoveAllQueries();
  746.  
  747.         // NotifyQueries
  748.         //
  749.         //
  750.  
  751.         virtual WBool NotifyQueries( WEventID id, WEventData *data=NULL );
  752.  
  753.         /****************************************************************
  754.          * Deprecated
  755.          ****************************************************************/
  756.  
  757.         virtual WBool GetErrorInfo( WString *errorMessage,
  758.                                     WString *state = NULL,
  759.                                     WLong *nativeErrorCode = NULL ) const;
  760.  
  761.         /****************************************************************
  762.          * Internal
  763.          ****************************************************************/
  764.  
  765.     private:
  766.  
  767.         // AllocateTransaction
  768.         //
  769.         //
  770.  
  771.         WBool AllocateTransaction( WDWord env=0, WDWord conn=0 );
  772.  
  773.     protected:
  774.  
  775.         WVector<WQuery>         _queries;       // attached WQuery objects
  776.         WTransaction *          _trans;         // transaction driver
  777.         WString                 _dbmsName;
  778.         WBool                   _traceToLog;
  779.         WULong                  _traceLevel;
  780.  
  781.         #ifdef _DEBUG
  782.  
  783.         class WCMCLASS TTrace {
  784.             public:
  785.                 TTrace( const WTransaction *, const WChar * );
  786.                 ~TTrace();
  787.  
  788.                 const WTransaction *transaction;
  789.                 const WChar        *function;
  790.         };
  791.  
  792.         friend class TTrace;
  793.  
  794.         void TDbg( const TTrace *q, const WChar *format, ... ) const;
  795.  
  796.         #endif
  797. };
  798.  
  799. class WCMCLASS WTransactionFactory : public WObject {
  800.  
  801.     protected:
  802.  
  803.         WTransactionFactory();
  804.  
  805.         ~WTransactionFactory();
  806.  
  807.     public:
  808.  
  809.         static WTransactionFactory *GetFactoryObject();
  810.  
  811.         static WTransaction *Allocate( const WString & dbmsName, WTransaction *proxy );
  812.  
  813.         static void Register( WTransaction * WCMDEF (*func)( const WString &, WTransaction * ) );
  814.         static void Deregister( WTransaction * WCMDEF (*func)( const WString &, WTransaction * ) );
  815.  
  816.     protected:
  817.         wllist_header                list;
  818.  
  819.     private:
  820.         static WTransactionFactory *_theObject;
  821. };
  822.  
  823. #endif
  824.